//package com.kalvan.web.servlet.interceptor;
//
//import com.kalvan.log.logback.layout.converter.LogTraceIdConverter;
//import feign.RequestInterceptor;
//import feign.RequestTemplate;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//import java.util.Enumeration;
//
///**
// * 扩展feign请求增加日志戳到head传递
// *
// * @author chenliang
// * @see CallInterfaceInterceptor 中接受该参数
// */
//@Slf4j
//@Component
//public class FeignAddHeaderRequestInterceptor implements RequestInterceptor {
//    public static final String X_LOG_TRACE_ID = "x_log_trace_id";
//
//    @Override
//    public void apply(RequestTemplate template) {
//        //传递日志戳
//        template.header(X_LOG_TRACE_ID, LogTraceIdConverter.getCurrentLogTraceId());
//        //传递head
////        ServletRequestAttributes servletRequestAttributes = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes());
////        if (servletRequestAttributes != null) {
////            HttpServletRequest request = servletRequestAttributes.getRequest();
////            Enumeration<String> headerNames = request.getHeaderNames();
////            if (headerNames != null) {
////                while (headerNames.hasMoreElements()) {
////                    String name = headerNames.nextElement();
////                    String values = request.getHeader(name);
////                    template.header(name, values);
////                }
////            }
////        }
//    }
//}
